//package com.example.quartz.config;
//
//import com.example.quartz.job.DemoJob;
//import org.quartz.*;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import java.text.ParseException;
//import java.util.Random;
//
///**
// * @author dangwen1
// * @date 2022年01月20日 10:44
// * @description
// */
//@Configuration
//public class QuartzConfig {
//
//    @Bean
//    public JobDetail jobDetail(){
//        return JobBuilder.newJob(DemoJob.class).storeDurably().build();
//    }
//
//    @Bean
//    public Trigger myTrigger() throws ParseException {
////        SimpleScheduleBuilder simpleScheduleBuilder = SimpleScheduleBuilder.simpleSchedule()
////                .withIntervalInSeconds(1).repeatForever();
//        int second = (int) (Math.random() * 60);
//        int min = (int) (Math.random() * 60);
//        System.out.println("second:" + second + ",min:" + min);
//        String corn = second + " " + min + " 23 * * ?";
////        String corn = "03 31 22 * * ?";
//        System.out.println(corn);
//        CronExpression cronExpression = new CronExpression(corn);
//        CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(cronExpression);
//        return TriggerBuilder.newTrigger().forJob(jobDetail()).withSchedule(cronScheduleBuilder).build();
//    }
//}
